<%--
 *  File:    PrivListDetail.jsp
 *  @Author: Langerwang 
 *  Date:    2001/11/29
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.OvalLabel" %>
<%@ page import="com.oval.util.OvalCustomColumn" %>
<%@ page import="com.oval.util.OvalCustomMessage" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.PrivListDetail"); 
%>


<%
  //init param
  String strTableName = "ovprivlistdetail";
  String strModuleName = "UPM";
  String privilegeCode = "Z0201,L403";
%>



<%
  cat.info("to get id");
  Integer nPrivListId = null;
  cat.info("to get name");
%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>PrivListDetail</title>
<PageFlow:CheckPageFlow pageName="privlistdetail"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js">
</script>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<%
  if(nPrivListId == null)
  {
    nPrivListId = (Integer)pageContext.getAttribute("privlistid");
  }
  boolean bCanUpdate = true;
  String strPrivListCode = new String("");
  HashMap plInfo = (HashMap)pageContext.getAttribute("privlistinfo");
  if(plInfo.get("privlistcode") != null)
    strPrivListCode = (String)plInfo.get("privlistcode");
  if(strPrivListCode != null && (strPrivListCode.equalsIgnoreCase("UPM1") || strPrivListCode.equalsIgnoreCase("UPM2")))
  {
    bCanUpdate = false;
  }
  
  //get data
  Vector privListDetail = (Vector)pageContext.getAttribute("privlistdetail");
  if(privListDetail == null)
  {
    privListDetail = new Vector();
  }
  Vector allUsers = (Vector)pageContext.getAttribute("alluser");
  if(allUsers == null)
  {
    allUsers = new Vector();
  }
  cat.debug("privlistdetail is " + privListDetail);
  cat.debug("all users is " + allUsers);
 
  cat.debug("The strCurOrderByCol is :" + strCurOrderByCol);
  cat.debug("The strCurOrderByType is :" + strCurOrderByType);
  cat.debug("The nCurMaxItem is :" + nCurMaxItem);  
  cat.debug("The nCurCount is :" + nCurCount);  
  cat.debug("The nCurPageNo is :" + nCurPageNo);
  cat.debug("The nCurTotalPage is :" + nCurTotalPage);
  cat.debug("The nCurEndIndex is :" + nCurEndIndex);
  cat.debug("The bCurHasPre is :" + bCurHasPre);
  cat.debug("The bCurHasNext is :" + bCurHasNext);
  cat.debug("The nCurRowCount is :" + nCurRowCount);          
%>
</head>
<script> 
function page_delete()
{
  if(nullChecked(document.privlistdetailform.privlistdetailids,document.privlistdetailform.rowcount.value))
  {
    alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>");
    return;
  }
  var flag = confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>");
  if(!flag)
    return;
  document.privlistdetailform.actionname.value = "delete";
  isRunning = true;
  document.privlistdetailform.submit();
}
function refreshWindow()
{
  parent.down.location.href = "PrivListDetail.jsp?<%= OvalTools.randomURL() %>&privlistid=<%=JspHelper.filterNull( nPrivListId )%>" + "&languagecode=<%= strLanguageCode %>" ;
}
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(privlistdetailform,actionvalue,orderbyname);
  editform.action = "PrivListDetail.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}
</script>
<body>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
  <form name="privlistdetailform" method="post" action="../../Dispatcher">
  <input type="hidden" name="pagename" value="privlistdetail">
  <input type="hidden" name="actionname">  
  <input type="hidden" name="privlistid" value = "<%=JspHelper.filterNull( nPrivListId )%>">    
  <input type="hidden" name="privlistcode" value = "<%=JspHelper.filterNull( strPrivListCode )%>"> 
  <% //--------------------------------------  page location --%>	
  <tr> 
    <td> 
      <table width="94%" cellspacing="0" cellpadding="0">
        <tr> 
          <td colspan="2" class="summary_top"></td>
        </tr>
      </table>
        <img src="../../images/<%= strLanguageCode %>/quote.gif"><%= label.getLabelName("L_PrivListCode") + label.getLabelName("L_Colon") %><%=JspHelper.filterNull( plInfo.get("privlistcode") )%> <br>
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
        <tr class="deepblue-left"> 
          <td width="22" class="title_center">&nbsp;</td>
          <td width="100" class="title_center"><a href="javascript:page_summary('orderby','privilegecode')"><%= label.getLabelName("L_PrivilegeCode") %></a></td>
          <td width="150" class="title_center"><a href="javascript:page_summary('orderby','privilegename')"><%= label.getLabelName("L_PrivilegeName") %></a></td>
          <td class="title_center"><a href="javascript:page_summary('orderby','app')"><%= label.getLabelName("L_AppModuleCode") %></a></td>
        </tr>
          <%
            int i = 0;
            String strIsChecked = "Checked";
            String strClassType = new String();
          %>
            <logic:iterate id="privlistdetail" collection="<%= privListDetail %>">   
          <%
            HashMap detailMap = (HashMap)pageContext.getAttribute("privlistdetail");  
            if(i%2 == 1){
              strClassType = "td-listrom";
            }else{                    
              strClassType = "";
            } 
            if(i != 0)
            {          
              strIsChecked = "";
            }  
            i++;        
          %>                  
           <tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'"  class="<%=JspHelper.filterNull(strClassType)%>">
          
          <td width="22" class="<%=JspHelper.filterNull( strClassType )%>">
<%if(bCanUpdate){%>
              <input type="checkbox" name="privlistdetailids" value="<%=JspHelper.filterNull( detailMap.get("privlistdetailid") )%>" class="normalradio">
<%}%>
          </td>
          <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( detailMap.get("privilegecode") )%></td>
          <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( detailMap.get("privilegename") )%></td>
          <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( detailMap.get("app") )%></td>
        </tr>
          </logic:iterate>
    <% //--------------------------------------  flipping page --%>
    <%@ include file="/inc/SummaryAction.inc" %>
     </table>
    </td>
  </tr>
  <tr> 
    <td class="summary_top"></td>
  </tr>
  <tr> 
    <td class="td_center">
      <%if(bCanUpdate){%>
         <a onclick="allChecked(privlistdetailform)"><custom:button type="1" label="L_Saveall" imgsrc="saveall.gif" border="0" style="width:60"/></a>
         <a onclick="allCancel(privlistdetailform)"><custom:button type="1" label="L_Resetmarks" imgsrc="resetmarks.gif" border="0"/></a>
         <a onclick="popup('PrivListDetailJump.jsp?<%= OvalTools.randomURL() %>&privlistid=<%=JspHelper.filterNull( nPrivListId )%>','newwindow','height=220, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no')"><custom:button type="1" label="L_Add" imgsrc="add.gif" border="0" style="width:60"/></a>
         <a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
      <%}%>
    </td>
  </tr>
</table>
</body>
</html>


